﻿using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;

namespace moc.Models.Migrations
{
    public partial class InitialCreate : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "AdminInfo",
                columns: table => new
                {
                    Admin_id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Admin_name = table.Column<string>(type: "longtext", nullable: true),
                    Password = table.Column<string>(type: "longtext", nullable: true),
                    Role_id = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AdminInfo", x => x.Admin_id);
                });

            migrationBuilder.CreateTable(
                name: "AdminRole",
                columns: table => new
                {
                    Role_id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Order_role = table.Column<bool>(type: "bit", nullable: false),
                    Product_role = table.Column<bool>(type: "bit", nullable: false),
                    Role_name = table.Column<string>(type: "longtext", nullable: true),
                    Sys_role = table.Column<bool>(type: "bit", nullable: false),
                    User_role = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AdminRole", x => x.Role_id);
                });

            migrationBuilder.CreateTable(
                name: "CustomerInfo",
                columns: table => new
                {
                    Customer_inf_id = table.Column<Guid>(type: "char(36)", nullable: false),
                    Address = table.Column<string>(type: "longtext", nullable: true),
                    Birthday = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    Customer_email = table.Column<string>(type: "longtext", nullable: true),
                    Customer_img = table.Column<string>(type: "longtext", nullable: true),
                    Customer_name = table.Column<string>(type: "longtext", nullable: true),
                    Customer_phone = table.Column<string>(type: "longtext", nullable: true),
                    Gender = table.Column<string>(type: "longtext", nullable: true),
                    Register_time = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    Sign = table.Column<string>(type: "longtext", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CustomerInfo", x => x.Customer_inf_id);
                });

            migrationBuilder.CreateTable(
                name: "CustomerLogin",
                columns: table => new
                {
                    Customer_id = table.Column<Guid>(type: "char(36)", nullable: false),
                    Login_name = table.Column<string>(type: "longtext", nullable: true),
                    Password = table.Column<string>(type: "longtext", nullable: true),
                    Status = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CustomerLogin", x => x.Customer_id);
                });

            migrationBuilder.CreateTable(
                name: "OrderCart",
                columns: table => new
                {
                    Cart_id = table.Column<Guid>(type: "char(36)", nullable: false),
                    Customer_id = table.Column<Guid>(type: "char(36)", nullable: false),
                    Price = table.Column<decimal>(type: "decimal(65, 30)", nullable: false),
                    Product_count = table.Column<int>(type: "int", nullable: false),
                    Product_id = table.Column<Guid>(type: "char(36)", nullable: false),
                    Time = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_OrderCart", x => x.Cart_id);
                });

            migrationBuilder.CreateTable(
                name: "OrderDetail",
                columns: table => new
                {
                    Detail_id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Order_id = table.Column<Guid>(type: "char(36)", nullable: false),
                    Product_count = table.Column<string>(type: "longtext", nullable: true),
                    Product_id = table.Column<Guid>(type: "char(36)", nullable: false),
                    Product_name = table.Column<string>(type: "longtext", nullable: true),
                    product_price = table.Column<decimal>(type: "decimal(65, 30)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_OrderDetail", x => x.Detail_id);
                });

            migrationBuilder.CreateTable(
                name: "OrderMaster",
                columns: table => new
                {
                    Order_id = table.Column<Guid>(type: "char(36)", nullable: false),
                    Create_time = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    Customer_id = table.Column<string>(type: "longtext", nullable: true),
                    Customer_name = table.Column<string>(type: "longtext", nullable: true),
                    Order_number = table.Column<Guid>(type: "char(36)", nullable: false),
                    Order_status = table.Column<int>(type: "int", nullable: false),
                    Pay_method = table.Column<int>(type: "int", nullable: false),
                    Pay_time = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    Receive_time = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    discount_money = table.Column<decimal>(type: "decimal(65, 30)", nullable: false),
                    order_money = table.Column<decimal>(type: "decimal(65, 30)", nullable: false),
                    pay_money = table.Column<decimal>(type: "decimal(65, 30)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_OrderMaster", x => x.Order_id);
                });

            migrationBuilder.CreateTable(
                name: "ProductCategory",
                columns: table => new
                {
                    Category_id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Category_name = table.Column<string>(type: "longtext", nullable: true),
                    Parent_id = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProductCategory", x => x.Category_id);
                });

            migrationBuilder.CreateTable(
                name: "ProductComment",
                columns: table => new
                {
                    Comment_id = table.Column<Guid>(type: "char(36)", nullable: false),
                    Content = table.Column<string>(type: "longtext", nullable: true),
                    Customer_id = table.Column<Guid>(type: "char(36)", nullable: false),
                    Degree = table.Column<int>(type: "int", nullable: false),
                    Product_id = table.Column<Guid>(type: "char(36)", nullable: false),
                    Time = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProductComment", x => x.Comment_id);
                });

            migrationBuilder.CreateTable(
                name: "ProductInfo",
                columns: table => new
                {
                    Product_id = table.Column<Guid>(type: "char(36)", nullable: false),
                    Category_id = table.Column<int>(type: "int", nullable: false),
                    Descript = table.Column<string>(type: "longtext", nullable: true),
                    Discount = table.Column<double>(type: "double", nullable: false),
                    Entry_time = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    Price = table.Column<decimal>(type: "decimal(65, 30)", nullable: false),
                    Product_img = table.Column<string>(type: "longtext", nullable: true),
                    Product_name = table.Column<string>(type: "longtext", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProductInfo", x => x.Product_id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "AdminInfo");

            migrationBuilder.DropTable(
                name: "AdminRole");

            migrationBuilder.DropTable(
                name: "CustomerInfo");

            migrationBuilder.DropTable(
                name: "CustomerLogin");

            migrationBuilder.DropTable(
                name: "OrderCart");

            migrationBuilder.DropTable(
                name: "OrderDetail");

            migrationBuilder.DropTable(
                name: "OrderMaster");

            migrationBuilder.DropTable(
                name: "ProductCategory");

            migrationBuilder.DropTable(
                name: "ProductComment");

            migrationBuilder.DropTable(
                name: "ProductInfo");
        }
    }
}
